package org.online.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;



/**
 * 用户退出登录
 * 
 * @author Administrator
 *
 */
@WebServlet("/logout.do")
public class LogoutServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		// 1.获取会话对象
		HttpSession session = req.getSession();
			
		// 2.让会话对象失效
		session.invalidate();
		
		// 3.页面跳转到登录页面
		resp.sendRedirect("login.html");
	}

}
